package com.his.controller;


import com.his.entity.CaseHistory;
import com.his.entity.Patient;
import com.his.entity.Registration;
import com.his.entity.ResponseResult;
import com.his.service.IPatientService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 病人基本信息表 前端控制器
 * </p>
 *
 * @author Demoon Liu
 * @since 2022-02-20
 */
@RestController
@Tag(name = "患者管理模块接口")
public class PatientController {

    @Resource
    private IPatientService iPatientService;

    @PostMapping("/patient/query")
    @Operation(summary = "根据身份证查询患者信息", description = "输入身份证，返回该患者信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "查询成功"),
            @ApiResponse(responseCode = "250", description = "查询失败"),
    })
    public ResponseResult selectPatientByIdNo(@RequestBody Patient patient){
        return iPatientService.selectPatientByIdNo(patient);
    }

    @PostMapping("/patient/query1")
    @Operation(summary = "查询全部患者信息", description = "返回全部患者信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "查询成功"),
            @ApiResponse(responseCode = "250", description = "查询失败"),
    })
    public ResponseResult selectAllPatient(){
        return iPatientService.selectAllPatient();
    }

    @PostMapping("/patient/update")
    @Operation(summary = "根据门诊号修改诊断表信息", description = "输入门诊号，修改Endattendance")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "修改成功"),
            @ApiResponse(responseCode = "250", description = "修改失败"),
    })
    public ResponseResult updateDiagnosisStatus(@RequestBody Registration registration){
        return iPatientService.updateDiagnosisStatus(registration);
    }

    @PostMapping("/patient/query2")
    @Operation(summary = "根据门诊号查询病历表信息", description = "输入门诊号，返回该患者历史病历信息")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "查询成功"),
            @ApiResponse(responseCode = "250", description = "查询失败"),
    })
    public ResponseResult selectCaseHistoryByPatient(@RequestBody CaseHistory caseHistory){
        return iPatientService.selectCaseHistoryByPatient(caseHistory);
    }

}
